from farmakework.base_page import BasePage


class Sjpz(object):  # 试卷配置页面类

    stlx_xpath = '//*[@id="tab-class_practice"]'  # 随堂练习按钮
    kczy_xpath = '//*[@id="tab-coursework"]'  # 课程作业按钮
    kcks_xpath = '//*[@id="tab-course_test"]'  # 课程考试按钮
    byks_xpath = '//*[@id="tab-graduation_exam"]'  # 毕业考试按钮
    xzsj_xpath = '//*[@id="content"]/div/div[1]/div[2]/button/span'  # 新增试卷按钮
    sjzt_xpath = '//*[@id="pane-class_practice"]/div/div[1]/div[1]/div/div[1]/input'  # 试卷状态下拉框
    sjmc_xpath = '//*[@id="pane-class_practice"]/div/div[1]/div[2]/div/input'  # 试卷名称文本框
    cx_xpath = '//*[@id="pane-class_practice"]/div/div[1]/div[3]/button/span'  # 查询按钮
    line1_xpath = '//*[@id="pane-class_practice"]/div/div[2]/div[3]/table/tbody/tr[1]/td[5]/div/div/button/span'  # 列表
    # 第一行数据编辑按钮
    page_no_xpath = '//*[@id="pane-class_practice"]/div/div[3]/div/span/div/input'  # 第几页文本框

    def onclick_po(self, value, driver: BasePage):  # 点击试卷配置页面按钮---value:要点击的组件 driver:封装的driver
        if value == '随堂练习':
            driver.onclick(dwff='xpth', ys=self.stlx_xpath)
        elif value == '课程作业':
            driver.onclick(dwff='xpth', ys=self.kczy_xpath)
        elif value == '课程考试':
            driver.onclick(dwff='xpth', ys=self.kcks_xpath)
        elif value == '毕业考试':
            driver.onclick(dwff='xpth', ys=self.byks_xpath)
        elif value == '新增试卷':
            driver.onclick(dwff='xpth', ys=self.xzsj_xpath)
        elif value == '试卷状态':
            driver.onclick(dwff='xpth', ys=self.sjzt_xpath)
        else:
            print('不存在的页面模块')

    def send_keys(self, driver: BasePage, zjz, textvalue):  # 试卷配置页面文本框输入值 zjz：组件值
        if zjz == '试卷名称':
            driver.send_keys(dwff='xpath', ys='', value=textvalue)


















        print()


